package com.wenxixuanwu.fruitstore.controller;

import com.wenxixuanwu.fruitstore.entity.OrderListVO;
import com.wenxixuanwu.fruitstore.service.BackOrderService;
import com.wenxixuanwu.fruitstore.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author :小凡凡
 * @version :1.0
 * @Project :fruitstore
 * @Date :2022/5/5
 */
@RestController
@RequestMapping("/backOrder")
public class BackOrderController extends BaseController{

    @Autowired
    private BackOrderService orderService;

    @GetMapping("/findOrderAll")
    public JsonResult<List<OrderListVO>> findOrderAll(){
        List<OrderListVO> data = orderService.findOrderAll();
        return new JsonResult<List<OrderListVO>>(OK,data);
    }

    @GetMapping("/updateStateById/{oid}")
    public JsonResult<Void> updateStateById(@PathVariable("oid") String id){
        Integer data = orderService.updateStateById(id);
        return new JsonResult<Void>(OK);
    }

    @GetMapping("/orderDelete/{oid}")
    public JsonResult<Void> orderDelete(@PathVariable("oid") String id){
        Integer data = orderService.orderDelete(id);
        return new JsonResult<Void>(OK);
    }
}
